﻿using System;
using System.Data.Linq.Mapping;

namespace NewsPortal.DataContracts
{
    [Table(Name = "dbo.News")]
    public class News
    {
        [Column(Name = "Id", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true)]
        public Guid Id { get; set; }

        [Column(Name = "Moment", DbType = "DateTime NOT NULL")]
        public DateTime Moment { get; set; }

        [Column(Name = "Title", DbType = "NVarChar(MAX) NOT NULL", CanBeNull = false)]
        public string Title { get; set; }

        [Column(Name = "ShortText", DbType = "NVarChar(MAX) NOT NULL", CanBeNull = false)]
        public string ShortText { get; set; }

        [Column(Name = "Body", DbType = "Text NOT NULL", CanBeNull = false)]
        public string Body { get; set; }

        [Column(Name = "Version", DbType = "rowversion NOT NULL", CanBeNull = false, IsDbGenerated = true, IsVersion = true)]
        public byte[] Version { get; set; }

        [Column(Name = "CategoryId", DbType = "UniqueIdentifier NOT NULL", CanBeNull = false)]
        public Guid CategoryId { get; set; }

        [Column(Name = "PictureId", DbType = "UniqueIdentifier NOT NULL", CanBeNull = false)]
        public Guid PictureId { get; set; }
    }
}
